package com.card.hwatt.assembler;

import java.util.ArrayList;
import java.util.List;

import com.card.hwatt.core.ObjectUtil;
import com.card.hwatt.entity.Employee;

/**
 * 员工
 * @author Administrator
 *
 */
public final class EmployeeAssembler {

	public static List<com.card.hwatt.dto.Employee> convert(List<Employee> list) {
		List<com.card.hwatt.dto.Employee> rows = new ArrayList<com.card.hwatt.dto.Employee>();
		for (Employee item : list) {
			com.card.hwatt.dto.Employee dto = convert(item);
			dto.departmentId = item.department.id;
			dto.departmentName = item.department.name;
			rows.add(dto);
		}
		return rows;
	}

	public static com.card.hwatt.dto.Employee convert(Employee entity) {
		com.card.hwatt.dto.Employee dto = new com.card.hwatt.dto.Employee();
		ObjectUtil.fieldCopy(entity, dto);
		return dto;
	}

	public static Employee convert(com.card.hwatt.dto.Employee dto) {
		Employee entity = new Employee();
		ObjectUtil.fieldCopy(dto, entity);
		return entity;
	}
}
